home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / 8bit / cislib_a / exec.act < prev    next >
Text File  |  1995-04-22  |  1KB  |  66 lines

  1.  
  2. ;Com_Exec, by Craig S. Thom 1987
  3. ;This PROC, when used with SpartaDOS
  4. ;v2.5 or greater, will allow the    
  5. ;execution of ANY command processor
  6. ;command from within an Action!
  7. ;program.  For example, Com_Exec("DIR D2:")
  8. ;will print the directory of D2: to
  9. ;the screen without otherwise altering
  10. ;the execution of any program.
  11. ;Care should be taken when executing
  12. ;external commands, however, since
  13. ;they may overwrite program memory.
  14.  
  15. PROC VXCOMLI()
  16.  
  17. ;LDA PORTB   ;gets bank select status
  18. ;PHA         ;and saves on stack.
  19. ;AND #FE     ;resets bit 0, disabling
  20. ;STA PORTB   ;ROM $C000-$CFFF & $F000-$FFFF.
  21. ;JSR VXCOMLI ;calls execute routine.
  22. ;PLA         ;restores bank select
  23. ;STA PORTB   ;status.
  24. ;RTS         ;return.   
  25.  
  26. [$AD$01$D3$48$29$FE$8D$01$D3
  27.  $20$D2$FF$68$8D$01$D3$60]
  28.  
  29.  
  30. PROC Com_Exec(BYTE ARRAY command) 
  31.  
  32.   CARD POINTER DOSVEC
  33.              
  34.   BYTE POINTER LBUF,
  35.                BUFOFF  
  36.  
  37.   BYTE Sparta =$700,
  38.        version=$701,
  39.        i
  40.  
  41.  
  42.   IF Sparta<>$53 OR version<$25 THEN
  43.    PrintE("ComEx works only with SpartaDOS v2.5")
  44.    PrintE("or greater.")
  45.    RETURN
  46.   FI
  47.   IF command(0)>64 THEN 
  48.    PrintE("Command too long!")
  49.    RETURN
  50.   FI
  51.   DOSVEC=$000A
  52.   LBUF=DOSVEC^+63
  53.   BUFOFF=DOSVEC^+10
  54.   BUFOFF^=0 ;set buffer offset to 0
  55.   FOR i=1 TO command(0);Copy command into
  56.    DO                  ;CP buffer
  57.     LBUF^=command(i)
  58.     LBUF==+1
  59.    OD
  60.   LBUF^=$9B
  61.   VXCOMLI()
  62.   
  63. RETURN
  64.  
  65. MODULE
  66. 99999999999999999999999999999999999999999999999999999999999999999999999